package uo.ri.bussiness.impl.admin;

import java.sql.SQLException;

import alb.util.jdbc.Jdbc;

public class DeleteMechanic extends MechanicBase{
	
	
	private Long idMecanico;
	
	public DeleteMechanic(Long idMecanico){
		this.idMecanico = idMecanico;
	}
	
	public void execute() {
		

		try {
			prepareDB();
			
			mecanicosGateway.delete(idMecanico);
			connection.commit();
			
		} catch (SQLException e) {
			try {
				connection.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
			throw new RuntimeException(e);
		}
		finally {
			Jdbc.close(connection);
		}
	}

}
